import datetime
from typing import List, Optional
import ormar

from app.core.db import metadata, database
from app.expert.models import Expert
from app.customer.models import Customer

class Expertise(ormar.Model):
    class Meta:
        metadata = metadata
        database = database
        tablename = 'expertise'


    id: int = ormar.Integer(primary_key=True)
    expert_id: int = ormar.ForeignKey(Expert, nullable=True)
    customer_id: int = ormar.ForeignKey(Customer, nullable=True)
    date_of_receipt_of_materials: datetime.date = ormar.Date()
    research_start_date: datetime.date = ormar.Date()
    research_end_date: datetime.date = ormar.Date()
    expert_detention_date: datetime.date = ormar.Date()
    cost_of_expertise: int = ormar.Integer()
    type_expertise: str = ormar.String(max_length=128)
    number_of_objects_research: int = ormar.Integer()
    types_of_conclusions: Optional[str] = ormar.String(max_length=256)
    text_of_conclusion: str = ormar.String(max_length=2048)

